{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/minimum-absolute-difference-in-bst\n",
    "\n",
    "\n",
    "\n",
    "Runtime: 60 ms, faster than 34.55% of Python3 online submissions for Minimum Absolute Difference in BST.\n",
    "Memory Usage: 16.8 MB, less than 7.31% of Python3 online submissions for Minimum Absolute Difference in BST.\n",
    "\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def getMinimumDifference(self, root: TreeNode) -> int:\n",
    "        self.set = set()\n",
    "        self.travel(root)\n",
    "        l = list(self.set)\n",
    "        l.sort()\n",
    "        #print(l)\n",
    "        diff = [v-l[i-1] for i,v in enumerate(l) if i!=0]\n",
    "        diff.sort()\n",
    "        #print(diff)\n",
    "        return diff[0]\n",
    "        \n",
    "    def travel(self, root):\n",
    "        if root == None:\n",
    "            return \n",
    "        self.set.add(root.val)\n",
    "        self.travel(root.left)\n",
    "        self.travel(root.right)\n",
    "```\n",
    "\n",
    "\n",
    "Spent 5 minutes\n",
    "\n",
    "2 Shoot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
